import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:new_yuqib_app/yqbConfig/color_theme.dart';

import 'controller.dart';

///主页
class IndexView extends StatelessWidget {
  const IndexView({super.key});

  @override
  Widget build(BuildContext context) {
    final logic = Get.put(IndexViewController());
    return Scaffold(
      body: Obx(() {
        return IndexedStack(
          index: logic.index.value,
          children: List.generate(
            logic.indexPages.length,
            (index) => logic.indexPages[index],
          ),
        );
      }),
      bottomNavigationBar: Obx(() {
        return BottomNavigationBar(
          currentIndex: logic.index.value,
          backgroundColor: Colors.white,
          onTap: logic.changeIndex,
          iconSize: 16,
          selectedItemColor: ColorTheme.buttonTextColor,
          selectedFontSize: 10,
          unselectedItemColor: ColorTheme.secondaryTextColor,
          unselectedFontSize: 10,
          elevation: 0,
          items: logic.botBarItems,
        );
      }),
    );
  }
}
